package info.rodinia.tokenmaker;

import java.util.ArrayList;

/** 
 * Feat models D&D 4E feats.  
 * All I'm really doing here is keeping an HTML representation of the feat on the token for ease of look up during the game.
 * @author Blakey - Summer 2010
 *
 */
public class Feat {
    // compendium info
    private int id = 0;
    private String html = null;
    private String name = "";
    private String detail = "";
    private String tier = "";
    private String description = "";
    private String special = "";    
    private String prerequisite = "";
    private String type = "";
    private String tags = "";

   
    
    public Feat(int id) {
	this.id = id;
    }

    public String getHTML() {
	// If we have tier filled out then we have all we need to build our HTML from that.
	if (!tier.equals("")) {
	    buildHTML();
	    return html;
	}
	
	if (id == 0)
	    return "";
	if (html == null) {
	    FeatCompendiumEntry com = new FeatCompendiumEntry(this);
	    html = com.getHTML();
	}
	return html;
    }

    public String toString() {
	return name;
    }

    public int getId() {
	return id;
    }

    public void setId(int id) {
	this.id = id;
    }

    public String getPrerequisite() {
        return prerequisite;
    }

    public void setPrerequisite(String prerequisite) {
        this.prerequisite = prerequisite;
    }

    public String getHtml() {
        return html;
    }

    public void setHtml(String html) {
        this.html = html;
    }

 
    public String getTier() {
        return tier;
    }

    public void setTier(String tier) {
        this.tier = tier;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getSpecial() {
        return special;
    }

    public void setSpecial(String special) {
        this.special = special;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public String getName() {
	return name;
    }

    public void setName(String name) {
	this.name = name;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    // buildHTML should only be called when we have tier set up already
    // so return if that is not true
    private void buildHTML() {
	if (tier.equals(""))  return;
	
	html="<div id=\"detail\">\n";
	html+="<h1 style=\"font:aerial;font-size:1.35em;font-weight: bold;line-height:2;padding-left:15px;margin:0;color:white;background: #1d3d5e;\" class=\"player\">"+name+"</h1>\n\n";
	html+="<p class=\"flavor\"><b>"+tier+" Tier</b><br/>\n\n";
	
	if (!prerequisite.equals("")) html+="<b>Prerequisite</b>: "+prerequisite+"<br/>\n\n";
	
	html+="<b>Benefit</b>: "+description+"<br/>\n\n";
	html+="</p>\n\n";
	html+="</div>\n\n";
	
    }
}
